<template>
  <div class="demo">
    <h1 v-text="msg"></h1>
    <h2>姓名:{{name}}</h2>
    <h2>年龄:{{MyAge+1}}</h2>
    <h2>性别:{{sex}}</h2>
    <button @click="unpdate">修改年龄</button>
  </div>
</template>

<script>
export default {
    name:'Person',
    data(){
        return{
            msg:'兔子小姐你好',
            MyAge:this.age
        }
    },
    methods:{
        unpdate() {
            this.MyAge++
        },
    },
    // props:['name','sex','age'] //简单接收
    /* props:{
        name:String,
        age:Number,
        sex:String
    } */
    props:{
        name:{
            type:String,
            required:true,
        },
        age:{
            type:Number,
            default:99
        },
        sex:{
            type:String,
            required:true,
        }
    }
}
</script>

<style>
    .demo{
        background-color: pink;
    }
</style>